<!DOCTYPE html>
<html lang="en-US">
    <head>
        <title>Term::Chrome - metacpan.org</title>
        <link rel="preload" as="fetch" href="https://metacpan.org/account/login_status" crossorigin="anonymous" />
        <link href="https://metacpan.org/_assets/b8ccceeed47a0652049703d99326a9cea4933443.css" rel="stylesheet" type="text/css">
        <script src="https://metacpan.org/_assets/6bfedafe2d7caa915b7d84f61b45936818e3242e.js" type="text/javascript" defer></script>
        <link rel="alternate" type="application/rss+xml" title="Recent CPAN Uploads of Term-Chrome - MetaCPAN" href="https://metacpan.org/dist/Term-Chrome/releases.rss" />
        <link rel="canonical" href="./Term::Chrome.html" />
        <meta name="description" content="DSL for colors and other terminal chrome" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">
        <link rel="shortcut icon" href="https://metacpan.org/static/icons/favicon.ico">
        <link rel="apple-touch-icon" sizes="152x152" href="https://metacpan.org/static/icons/apple-touch-icon.png">
        <link rel="search" href="https://metacpan.org/static/opensearch.xml" type="application/opensearchdescription+xml" title="MetaCPAN">
        <script>
          (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
          (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
          })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

          (function(skey, ga_id){
            ga('create', ga_id, {
              siteSpeedSampleRate : 100,
              storage             : 'none',
              clientId            : localStorage.getItem(skey)
            });
            ga(function(tracker) {
              localStorage.setItem(skey, tracker.get('clientId'));
            });
            ga('send', 'pageview');
          })('ga:clientId', 'UA-27829474-1');
        </script>
<meta name="twitter:card"        content="summary" />
<meta name="twitter:url"         content="https://metacpan.org/pod/Term::Chrome" />
<meta name="twitter:title"       content="Term::Chrome" />
<meta name="twitter:description" content="" />
<meta name="twitter:site"        content="metacpan" />
    </head>
    <body>
        <nav class="navbar navbar-default" role="navigation">
            <div class="header-logo-large hidden-xs">
              <a href="https://metacpan.org/" tabindex="0">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#logo" />
                </svg>
              </a>
            </div>
            <div class="header-logo-icon visible-xs">
              <a href="https://metacpan.org/">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#dots" />
                </svg>
              </a>
            </div>
            <ul class="nav navbar-nav menu-items hidden-xs hidden-sm">
              <li><a href="https://metacpan.org/about">About</a></li>
              <li><a href="https://metacpan.org/about/sponsors">Sponsor</a></li>
              <li><a href="https://grep.metacpan.org/">grep::cpan</a></li>
              <li><a href="https://metacpan.org/recent">Recent</a></li>
              <li><a href="https://metacpan.org/about/faq">FAQ</a></li>
              <li><a href="https://metacpan.org/tools">Tools</a></li>
              <li><a href="https://fastapi.metacpan.org/">API</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <button type="button" class="searchbar-btn visible-xs visible-sm">
                    <i class="fa fa-search button-fa-icon"></i>
                </button>
                <form action="https://metacpan.org/search" class="searchbar-form visible-md visible-lg search-form form-horizontal">
                   <input type="hidden" name="size" id="metacpan_search-size" value="20">
                  <div class="form-group">
                      <div class="search-group">
                        <i class="fa fa-search"></i>
                        <input type="text" name="q" placeholder="Search the CPAN" size="41" autocorrect="off" autocapitalize="off" spellcheck="false" id="metacpan_search-input" class="form-control" value="">
                      </div>
                  </div>
                </form>
                    <li class="icon-slidepanel visible-xs visible-sm">
                      <button data-toggle="slidepanel" data-target=".slidepanel">
                        <span class="button-fa-icon">
                          <i class="fa fa-bars slidepanel-open"></i>
                          <i class="fa fa-times slidepanel-close"></i>
                        </span>
                      </button>
                    </li>
                <form action="https://metacpan.org/account/logout" method="POST" id="metacpan-logout"></form>
                <li class="dropdown logged_in" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon logged-in-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a href="https://metacpan.org/account/identities">Identities</a></li>
                        <li><a href="https://metacpan.org/account/profile">Profile</a></li>
                        <li><a href="https://metacpan.org/account/favorite/list">Favorites</a></li>
                        <li>
                            <a href="./Term::Chrome.html#" type="button" onclick="$('#metacpan-logout').submit(); return false">
                              Logout
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_out" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li>
                            <a href="https://metacpan.org/login/github">
                                <i class="fab fa-github fa-fw"></i>
                                GitHub
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/twitter">
                                <i class="fab fa-twitter fa-fw"></i>
                                Twitter
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/google">
                                <i class="fab fa-google fa-fw"></i>
                                Google
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_placeholder">
                    <button>
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                    </button>
                </li>
            </ul>
        </nav>
        <div class="page-content ">
          <!--
          <div class="top-notify-banner">
            <i class="fas fa-info-circle"></i>
          </div>
          -->
          <nav class="sidebar">
            <div class="slidepanel">
              <ul class="nav-list ">
    <li class="nav-header no-margin-top">
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The date that this version of Term-Chrome was released.">
      <span class="relatize">20 Feb 2018 22:42:03 UTC</span>
    </li>
  <li>
    Distribution: <a href="https://metacpan.org/dist/Term-Chrome">Term-Chrome</a>
  </li>
  <li>
    Module version: 2.01
  </li>
  <li>
    <a data-keyboard-shortcut="g s" href="https://metacpan.org/dist/Term-Chrome/source/lib/Term/Chrome.pm">Source</a>
    (<a href="https://metacpan.org/dist/Term-Chrome/source/lib/Term/Chrome.pm?raw=1">raw</a>)
  </li>
  <li>
    <a data-keyboard-shortcut="g p" href="https://metacpan.org/dist/Term-Chrome/source/lib/Term/Chrome.pod">Pod Source</a>
    (<a href="https://metacpan.org/dist/Term-Chrome/source/lib/Term/Chrome.pod?raw=1">raw</a>)
  </li>
  <li>
    <a data-keyboard-shortcut="g b" href="https://metacpan.org/dist/Term-Chrome/source/lib/Term">Browse</a>
    (<a href="https://metacpan.org/dist/Term-Chrome/source/lib/Term?raw=1">raw</a>)
  </li>
    <li>
      <a data-keyboard-shortcut="g c" href="https://metacpan.org/dist/Term-Chrome/changes">Changes</a>
    </li>
    <li>
      <a rel="noopener nofollow" class="nopopup" href="https://github.com/dolmen-perl5/Term-Chrome">Homepage</a>
    </li>
    <li>
      <a class="nopopup" href="https://metacpan.org/dist/Term-Chrome/contribute">How to Contribute</a>
    </li>
    <li>
        <a rel="noopener nofollow" data-keyboard-shortcut="g r" href="https://github.com/dolmen-perl5/Term-Chrome">Repository</a>
    </li>
    <li>
      <a rel="noopener nofollow" data-keyboard-shortcut="g i" href="https://github.com/dolmen-perl5/Term-Chrome/issues">Issues</a>
      (1)
    </li>
    <li>
      <a rel="noopener nofollow" href="http://matrix.cpantesters.org/?dist=Term-Chrome+2.01" title="Matrix">Testers</a>
        <span title="(pass / fail / na)">(<a rel="noopener nofollow" href="https://www.cpantesters.org/distro/T/Term-Chrome.html?oncpan=1&amp;distmat=1&amp;version=2.01&amp;grade=2" style="color: #090">848</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/T/Term-Chrome.html?oncpan=1&amp;distmat=1&amp;version=2.01&amp;grade=3" style="color: #900">0</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/T/Term-Chrome.html?oncpan=1&amp;distmat=1&amp;version=2.01&amp;grade=4">14</a>)</span>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpants.cpanauthors.org/release/DOLMEN/Term-Chrome-2.01">Kwalitee</a>
    </li>
    <li>
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The # people with an indexing permission on Term-Chrome who have released something to CPAN in the last 2 years (i.e. the # people likely able to release critical fixes in a timely manner)">
      Bus factor: 0
      </div>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpancover.com/latest/Term-Chrome-2.01/index.html">86.83% Coverage </a>
    </li>
    <li>
      License: perl_5
    </li>
    <li>
      Perl: v5.8.5
    </li>
    <li class="nav-header">Activity</li>
    <li>
<div class="activity-graph">
    <img src="https://metacpan.org/dist/Term-Chrome/activity.svg?res=month" />
    <div class="comment">24 month</div>
</div>
    </li>
    <li class="nav-header">Tools</li>
    <li>
      <a itemprop="downloadUrl" href="https://cpan.metacpan.org/authors/id/D/DO/DOLMEN/Term-Chrome-2.01.tar.gz">
      Download (<span itemprop="fileSize">18KB</span>)</a>
    </li>
    <li>
      <a href="https://explorer.metacpan.org/?url=%2Fmodule%2FDOLMEN%2FTerm-Chrome-2.01%2Flib%2FTerm%2FChrome.pm">
        MetaCPAN Explorer
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/Term-Chrome/permissions">
        Permissions
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/Term-Chrome/releases.rss">
        Subscribe to distribution
      </a>
    </li>
    <li>
      <button class="btn btn-link" data-toggle="modal" data-target="#metacpan_install-instructions-dialog">
        Install Instructions
      </button>
    </li>
    <li>
      <form action="https://metacpan.org/search">
        <input type="hidden" name="q" value="dist:Term-Chrome">
        <input type="search" name="q" placeholder="Search distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
      </form>
    </li>
    <li>
      <form action="https://grep.metacpan.org/search">
        <input type="hidden" name="qd" value="Term-Chrome">
        <input type="hidden" name="source" value="metacpan">
        <input type="search" name="q" placeholder="grep distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
     </form>
    </li>
    <li class="version-jump">
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/lib/Term/Chrome.pm&#39;" class="form-control tool-bar-form">
  <option disabled selected>Jump to version</option>
<option
  disabled
  value="DOLMEN/Term-Chrome-2.01"
>2.01
  (DOLMEN on 2018-02-20)</option>
<option
  
  value="DOLMEN/Term-Chrome-1.013"
>1.013
  (DOLMEN on 2016-02-17)</option>
<optgroup label="BackPAN">'
<option
  
  value="DOLMEN/Term-Chrome-2.00"
>2.00
  (DOLMEN on 2016-03-04)</option>
<option
  
  value="DOLMEN/Term-Chrome-1.012"
>1.012
  (DOLMEN on 2015-11-03)</option>
<option
  
  value="DOLMEN/Term-Chrome-1.011"
>1.011
  (DOLMEN on 2015-10-21)</option>
<option
  
  value="DOLMEN/Term-Chrome-1.010"
>1.010
  (DOLMEN on 2015-10-20)</option>
<option
  
  value="DOLMEN/Term-Chrome-1.001"
>1.001
  (DOLMEN on 2014-08-23)</option>
<option
  
  value="DOLMEN/Term-Chrome-1.000"
>1.000
  (DOLMEN on 2014-08-23)</option>
</optgroup>
</select>
    </li>
    <li class="version-diff">
<select onchange="document.location.href='/release/DOLMEN/Term-Chrome-2.01/diff/' + encodeURIComponent(this.value) + '/lib/Term/Chrome.pm'
" class="form-control tool-bar-form">
  <option disabled selected>Diff with version</option>
<option
  disabled
  value="DOLMEN/Term-Chrome-2.01"
>2.01
  (DOLMEN on 2018-02-20)</option>
<option
  
  value="DOLMEN/Term-Chrome-1.013"
>1.013
  (DOLMEN on 2016-02-17)</option>
<optgroup label="BackPAN">'
<option
  
  value="DOLMEN/Term-Chrome-2.00"
>2.00
  (DOLMEN on 2016-03-04)</option>
<option
  
  value="DOLMEN/Term-Chrome-1.012"
>1.012
  (DOLMEN on 2015-11-03)</option>
<option
  
  value="DOLMEN/Term-Chrome-1.011"
>1.011
  (DOLMEN on 2015-10-21)</option>
<option
  
  value="DOLMEN/Term-Chrome-1.010"
>1.010
  (DOLMEN on 2015-10-20)</option>
<option
  
  value="DOLMEN/Term-Chrome-1.001"
>1.001
  (DOLMEN on 2014-08-23)</option>
<option
  
  value="DOLMEN/Term-Chrome-1.000"
>1.000
  (DOLMEN on 2014-08-23)</option>
</optgroup>
</select>
    </li>

    <li>
<ul class="dependencies">
  <li class="nav-header">Dependencies</li>
  <li><a href="https://metacpan.org/pod/Exporter" title="Exporter" class="ellipsis">Exporter</a></li>
  <li><a href="https://metacpan.org/pod/Scalar::Util" title="Scalar::Util" class="ellipsis">Scalar::Util</a></li>
  <li>
    <hr>
  </li>
  <li>
    <a href="https://metacpan.org/module/Term::Chrome/requires">Reverse dependencies</a>
  </li>
  <li>
    <a href="http://deps.cpantesters.org/?module=Term%3A%3AChrome">CPAN Testers List</a>
  </li>
  <li>
    <a href="https://cpandeps.grinnz.com/?dist=Term-Chrome">Dependency graph</a>
  </li>
</ul>
    </li>
    <li class="nav-header">Permalinks</li>
    <li>
      <a href="https://metacpan.org/release/DOLMEN/Term-Chrome-2.01/view/lib/Term/Chrome.pm">This version</a>
    </li>
    <li>
      <a href="./Term::Chrome.html">Latest version</a>
    </li>
    <li>
<div class="plussers">
<div class="nav-header">++ed by:</div>
<div>
<a class="display-all" href="https://metacpan.org/author/DOLMEN"><img src="https://www.gravatar.com/avatar/70d9b050bfe39350c234d710fadfcd39?d=identicon&amp;s=20" title="DOLMEN" alt="DOLMEN"></a>
</div>
<!-- Display counts of plussers-->
<div>
    <a href="https://metacpan.org/dist/Term-Chrome/plussers">1 PAUSE user</a>
</div>
<div>
    1 non-PAUSE user
</div>
</div>
    </li>
    <li>
    </li>
              </ul>
            </div>
          </nav>
          <div class="content-navigation">
<div class="breadcrumbs">
  <span>
    <a data-keyboard-shortcut="g a" rel="author" href="https://metacpan.org/author/DOLMEN" class="author-name">Olivier Mengué</a>
  </span>
  <span>&nbsp;/&nbsp;</span>
  <div class="release dist-release status-latest maturity-released">
    <span class="dropdown"><b class="caret"></b></span>
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/lib/Term/Chrome.pm&#39;" class="">
<option
  selected
  value="DOLMEN/Term-Chrome-2.01"
>2.01
  (DOLMEN on 2018-02-20)</option>
<option
  
  value="DOLMEN/Term-Chrome-1.013"
>1.013
  (DOLMEN on 2016-02-17)</option>
<optgroup label="BackPAN">'
<option
  
  value="DOLMEN/Term-Chrome-2.00"
>2.00
  (DOLMEN on 2016-03-04)</option>
<option
  
  value="DOLMEN/Term-Chrome-1.012"
>1.012
  (DOLMEN on 2015-11-03)</option>
<option
  
  value="DOLMEN/Term-Chrome-1.011"
>1.011
  (DOLMEN on 2015-10-21)</option>
<option
  
  value="DOLMEN/Term-Chrome-1.010"
>1.010
  (DOLMEN on 2015-10-20)</option>
<option
  
  value="DOLMEN/Term-Chrome-1.001"
>1.001
  (DOLMEN on 2014-08-23)</option>
<option
  
  value="DOLMEN/Term-Chrome-1.000"
>1.000
  (DOLMEN on 2014-08-23)</option>
</optgroup>
</select>
    <a data-keyboard-shortcut="g d" class="release-name" href="https://metacpan.org/dist/Term-Chrome">Term-Chrome-2.01</a>
  </div>
<span class="river-gauge-gauge">
  <svg width="24px"
       height="15px"
       version="1.1"
       xmlns="http://www.w3.org/2000/svg"
       xmlns:xlink="http://www.w3.org/1999/xlink">

    <g>
      <title>        River stage zero &#10;
          No dependents
      </title>

      <rect x="0"  y="0" width="4" height="15" fill="#e4e2e2" />
      <rect x="5"  y="0" width="4" height="15" fill="#e4e2e2" />
      <rect x="10"  y="0" width="4" height="15" fill="#e4e2e2" />
      <rect x="15"  y="0" width="4" height="15" fill="#e4e2e2" />
      <rect x="20"  y="0" width="4" height="15" fill="#e4e2e2" />
    </g>
  </svg>

</span>
<div id="Term-Chrome-fav" class="logged_in">
<form action="https://metacpan.org/account/favorite/add" style="display: inline" onsubmit="return favDistribution(this)">
    <input type="hidden" name="remove" value="0">
    <input type="hidden" name="release" value="Term-Chrome-2.01">
    <input type="hidden" name="author" value="DOLMEN">
    <input type="hidden" name="distribution" value="Term-Chrome">
    <button type="submit" class="favorite highlight"><span>2</span> ++</button>
</form>
</div>
<div class="logged_out">
<a href="./Term::Chrome.html" onclick="alert('Please sign in to add favorites'); return false" class="favorite highlight">
<span>2</span> ++</a>
</div>
   / <span>Term::Chrome</span>
</div>
          </div>
          <main class="content">


<nav class="toc">
  <div class="toc-header"><strong>Contents</strong></div>
<ul>
  <li><a href="./Term::Chrome.html#NAME">NAME</a></li>
  <li><a href="./Term::Chrome.html#SYNOPSIS">SYNOPSIS</a></li>
  <li><a href="./Term::Chrome.html#DESCRIPTION">DESCRIPTION</a></li>
  <li><a href="./Term::Chrome.html#EXPORTS">EXPORTS</a>
    <ul>
      <li><a href="./Term::Chrome.html#Functions">Functions</a></li>
      <li><a href="./Term::Chrome.html#Colors">Colors</a></li>
      <li><a href="./Term::Chrome.html#Decoration-flags">Decoration flags</a></li>
      <li><a href="./Term::Chrome.html#Special-flags">Special flags</a></li>
    </ul>
  </li>
  <li><a href="./Term::Chrome.html#METHODS">METHODS</a></li>
  <li><a href="./Term::Chrome.html#OVERLOADED-OPERATORS">OVERLOADED OPERATORS</a></li>
  <li><a href="./Term::Chrome.html#BUGS">BUGS</a></li>
  <li><a href="./Term::Chrome.html#REFERENCES">REFERENCES</a></li>
  <li><a href="./Term::Chrome.html#SEE-ALSO">SEE ALSO</a></li>
  <li><a href="./Term::Chrome.html#TRIVIA">TRIVIA</a></li>
  <li><a href="./Term::Chrome.html#AUTHOR">AUTHOR</a></li>
  <li><a href="./Term::Chrome.html#COPYRIGHT-&amp;-LICENSE">COPYRIGHT &amp; LICENSE</a></li>
</ul></nav>
<div class="pod anchors">
<h1 id="NAME">NAME</h1>

<p>Term::Chrome - DSL for colors and other terminal chrome</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<pre><code>    use Term::Chrome qw&lt;Red Blue Bold Reset Underline Green color&gt;;

    # Base color constant and attribute
    say Red, &#39;red text&#39;, Reset;

    # Composition, using operator overloading
    say Red/Blue+Bold, &#39;red on blue&#39;, Reset;

    # Undo
    say Bold, &#39;bold&#39;, !Bold, &#39;not bold&#39;;

    # Extended xterm-256 colors
    say color(125) + Underline, &#39;Purple&#39;, Reset;

    # Define your own constants
    use constant Pink =&gt; color 213;

    # Use ${} around Chrome expression inside strings
    say &quot;normal ${ Red+Bold } RED ${ +Reset } normal&quot;;

    # Extract components
    say( (Red/Blue)-&gt;bg, &quot;blue text&quot;, (Green+Reset)-&gt;flags );</code></pre>

<p>Chromizer: get a closure that applies given chrome before, and undo after the argument.</p>

<pre><code>    # Get an efficient chromizer
    my $boldifier = \&amp;{ +Bold };
    # Use the chromizer
    say $boldifier-&gt;(&quot;bold text&quot;);
    # Same as:
    say Bold, &quot;bold text&quot;, !Bold;

    # Short lived chromizers using color literals:
    say(&amp;{+Red}(&#39;red&#39;));
    say(&amp;{ Red/Blue + Bold }(&#39;red on blue&#39;));
    # Same, but requires perl 5.21.4+
    #say(( Red/Blue + Bold )-&gt;(&#39;red on blue&#39;));</code></pre>

<h1 id="DESCRIPTION">DESCRIPTION</h1>

<p><code>Term::Chrome</code> is a domain-specific language (DSL) for terminal decoration (colors and other attributes).</p>

<p>In the current implementation stringification to ANSI sequences for <code>xterm</code> and <code>xterm-256</code> is hard-coded (which means it doesn&#39;t use the <a href="http://man.he.net/man5/terminfo">terminfo(5)</a> database), but this gives optimized (short) strings.</p>

<p>Colors and attributes are exposed as objects that have overloading for arithmetic operators.</p>

<h1 id="EXPORTS">EXPORTS</h1>

<h2 id="Functions">Functions</h2>

<p><code>color(<i>0-255</i>)</code></p>

<p>Build a <a href="https://metacpan.org/pod/distribution/Term-Chrome/lib/Term/Chrome.pod">Term::Chrome</a> object with the given color number. You can use this constructor to create your own set of color constants.</p>

<p>For example, <code>color(0)</code> gives the same result as <code>Black</code> (but not the same object).</p>

<h2 id="Colors">Colors</h2>

<p>Each of these function return a Chrome object.</p>

<ul>

<li><p><code>Black</code>: <code>color 0</code></p>

</li>
<li><p><code>Red</code>: <code>color 1</code></p>

</li>
<li><p><code>Green</code>: <code>color 2</code></p>

</li>
<li><p><code>Yellow</code>: <code>color 3</code></p>

</li>
<li><p><code>Blue</code>: <code>color 4</code></p>

</li>
<li><p><code>Magenta</code>: <code>color 5</code></p>

</li>
<li><p><code>Cyan</code>: <code>color 6</code></p>

</li>
<li><p><code>White</code>: <code>color 7</code></p>

</li>
</ul>

<h2 id="Decoration-flags"><a id="Decoration"></a>Decoration flags</h2>

<p>The exact rendering of each flag is dependent on how the terminal implements them. For example <code>Underline</code> and <code>Blink</code> may do nothing.</p>

<ul>

<li><p><code>Bold</code></p>

</li>
<li><p><code>Underline</code></p>

</li>
<li><p><code>Blink</code></p>

</li>
<li><p><code>Reverse</code></p>

</li>
</ul>

<h2 id="Special-flags"><a id="Special"></a>Special flags</h2>

<ul>

<li><p><code>Reset</code>: reset all colors and flags</p>

</li>
<li><p><code>ResetFlags</code>: reset (undo) all chrome flags (Bold, Underline, Blink, Reverse)</p>

</li>
<li><p><code>ResetFg</code>: reset (undo) foreground color</p>

</li>
<li><p><code>ResetBg</code>: reset (undo) background color</p>

</li>
</ul>

<h1 id="METHODS">METHODS</h1>

<p>Here are the methods on <code>Term::Chrome</code> objects:</p>

<dl>

<dt id="fg"><code>fg</code></dt>
<dd>

<p>Extract the Chrome object of just the foreground color. Maybe <code>undef</code>.</p>

</dd>
<dt id="bg"><code>bg</code></dt>
<dd>

<p>Extract the Chrome object of the just background color. Maybe <code>undef</code>.</p>

</dd>
<dt id="flags"><code>flags</code></dt>
<dd>

<p>Extract a Chrome object of just the decoration flags. Maybe <code>undef</code>.</p>

</dd>
</dl>

<h1 id="OVERLOADED-OPERATORS"><a id="OVERLOADED"></a>OVERLOADED OPERATORS</h1>

<dl>

<dt id="/-(mnemonic:-&quot;over&quot;)"><a id="mnemonic:--over"></a><code>/</code> (mnemonic: &quot;over&quot;)</dt>
<dd>

<p>Combine a foreground color (on the left) with a background color.</p>

<p>Example:</p>

<pre><code>    my $red_on_black = Red / Black;</code></pre>

</dd>
<dt id="+"><a id="pod"></a><code>+</code></dt>
<dd>

<p>Add decoration flags (on the right) to colors (on the left).</p>

<p>Example:</p>

<pre><code>    my $bold_red = Red + Bold;</code></pre>

</dd>
<dt id="!-(negation)"><a id="negation"></a><code>!</code> (negation)</dt>
<dd>

<p>Returns a chrome which is the reverse of chrome to which negation is applied.</p>

<pre><code>    my $reset_foreground = ! Red;
    my $reset_colors = ! (Red / Black);</code></pre>

<p>The reverse of <code>Reset</code>, <code>ResetFg</code>, <code>ResetBg</code>, <code>ResetFlags</code> is nothing.</p>

</dd>
<dt id="&quot;&quot;-(stringification)"><a id="stringification"></a><code>&quot;&quot;</code> (stringification)</dt>
<dd>

<p>Transform the object into a string of ANSI sequences. This is particularly useful to directly use a Chrome object in a double quoted string.</p>

</dd>
<dt id="${}-(scalar-dereference)"><a id="scalar-dereference"></a><code>${}</code> (scalar dereference)</dt>
<dd>

<p>Same result as <code>&quot;&quot;</code> (stringification). This operator is overloaded because it is convenient to interpolate Chrome expressions in double-quoted strings.</p>

<p>Examples:</p>

<pre><code>    say &quot;normal ${ +Red } red ${ +Reset }&quot;;
    say &quot;normal ${ Red + Bold } red ${ +Reset }&quot;;</code></pre>

<p>Note that you must force expression parsing context when a Chrome constant is used alone inside <code>${ }</code>: <code>${ +Red }</code> or <code>${ (Red) }</code> or <code>${ Red() }</code>. <code>use strict &#39;vars&#39;;</code> will detect those cases, but you may miss them in one-liners.</p>

</dd>
<dt id="&amp;{}-(code-dereference,-or-codulation)"><a id="code-dereference--or-codulation"></a><code>&amp;{}</code> (code dereference, or <i>codulation</i>)</dt>
<dd>

<p>Wrap some text with the given chrome and <code>Reset</code>.</p>

<p>Example:</p>

<pre><code>    say Red-&gt;(&quot;red text&quot;);
    # Same result as:
    say Red, &quot;red text&quot;, Reset;</code></pre>

<p>Unfortunately perl had a bug (<a href="https://rt.perl.org/Ticket/Display.html?id=122607">perl RT#122607</a>) that makes this feature not much usable in practice when applied to constants. That bug is fixed in perl 5.21.4+. On perl &lt; 5.21.4 you have to wrap the chrome constant in a <code>do {}</code> or use <code>&amp;{}()</code>:</p>

<pre><code>    say do{ Red }-&gt;(&quot;red text&quot;);
    say &amp;{ +Red }(&quot;red text&quot;);</code></pre>

<p>Codulation can also be used to extract a colorizer sub that will be more efficient if you use it multiple times:</p>

<pre><code>    my $redifier = \&amp;{ Red };
    say $redifier-&gt;(&quot;red text&quot;);</code></pre>

</dd>
</dl>

<h1 id="BUGS">BUGS</h1>

<p>See the warnings about <code>${}</code> and <code>&amp;{}</code> above.</p>

<h1 id="REFERENCES">REFERENCES</h1>

<ul>

<li><p>ISO 6429 / ECMA 48: https://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf (reference for SGR is at page 61, numbered 75 in PDF)</p>

</li>
<li><p>XTerm Control Sequences: http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Functions-using-CSI-_-ordered-by-the-final-character_s_</p>

</li>
</ul>

<h1 id="SEE-ALSO"><a id="SEE"></a>SEE ALSO</h1>

<p>Comments on each modules are opinions of the author.</p>

<ul>

<li><p><a href="https://metacpan.org/pod/Term::ANSIColor">Term::ANSIColor</a>: the same basic features (and the others should not be in Term::ANSIColor itself but in an extension), but with an awful API I could never even consider to use while keeping my sanity.</p>

</li>
<li><p><a href="https://metacpan.org/pod/Term::ScreenColor">Term::ScreenColor</a></p>

</li>
<li><p><a href="https://metacpan.org/pod/PerlIO::via::ANSIColor">PerlIO::via::ANSIColor</a></p>

</li>
<li><p><a href="https://metacpan.org/pod/AngelPS1">AngelPS1</a> or <a href="https://github.com/dolmen/angel-PS1">https://github.com/dolmen/angel-PS1</a>: &quot;The Angel&#39;s Prompt&quot; is the project for which <code>Term::Chrome</code> has been built. <a href="https://metacpan.org/pod/AngelPS1::Compiler">AngelPS1::Compiler</a>, the <code>angel-PS1</code> compiler has special support for <code>Term::Chrome</code> values.</p>

</li>
</ul>

<h1 id="TRIVIA">TRIVIA</h1>

<p>Did you know that <i>chartreuse</i> is one of the favorite colors of Larry Wall?</p>

<h1 id="AUTHOR">AUTHOR</h1>

<p>Olivier Mengu&eacute; &lt;dolmen@cpan.org&gt;</p>

<h1 id="COPYRIGHT-&amp;-LICENSE"><a id="COPYRIGHT"></a><a id="COPYRIGHT---LICENSE"></a>COPYRIGHT &amp; LICENSE</h1>

<p>Copyright &copy; 2013-2018 Olivier Mengu&eacute;.</p>

<p>This library is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself.</p></div>

<div id="metacpan_install-instructions-dialog" class="modal fade">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title">Module Install Instructions</h4>
      </div>
      <div class="modal-body">
        <p>To install Term::Chrome, copy and paste the appropriate command in to your terminal.</p>
        <p><a href="https://metacpan.org/dist/App-cpanminus/view/bin/cpanm">cpanm</a></p>
        <pre><code>cpanm Term::Chrome</code></pre>
        <p><a href="https://metacpan.org/pod/CPAN">CPAN shell</a></p>
        <pre><code>perl -MCPAN -e shell
install Term::Chrome</code></pre>
        <p>For more information on module installation, please visit <a href="https://www.cpan.org/modules/INSTALL.html">the detailed CPAN module installation guide</a>.</p>
      </div>
      <div class="modal-footer">
        <a href="./Term::Chrome.html#" data-dismiss="modal" class="btn">Close</a>
      </div>
    </div>
  </div>
</div>
          </main>
          <div class="content-pagination">
          </div>
        </div>
        <footer class="footer">
          <div class="footer-container">
            <div class="footer-social">
              <div class="footer-link footer-logo">
                <a href="https://metacpan.org/">
                  <img src="https://metacpan.org/static/images/metacpan-logo.svg" alt="MetaCPAN" />
                </a>
              </div>
              <a class="footer-social-link" href="https://github.com/metacpan">
                <i class="fab fa-github-square"></i>
              </a>
              <a class="footer-social-link" href="https://fosstodon.org/@metacpan">
                <i class="fab fa-mastodon"></i>
              </a>
            </div>
            <div class="footer-links">
              <div class="footer-link">
                  <a href="https://metacpan.org/about">About</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/sponsors">Sponsor</a>
              </div>
              <div class="footer-link">
                  <a href="https://grep.metacpan.org">grep::cpan</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/recent">Recent</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/faq">FAQ</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/tools">Tools</a>
              </div>
              <div class="footer-link">
                  <a href="https://fastapi.metacpan.org/">API</a>
              </div>
              <div class="footer-link">
                  <a href="https://www.perl.org/">Perl.org</a>
              </div>
            </div>
            <div class="footer-sponsors">
              <a class="footer-sponsor-link" target="_blank" href="https://www.bytemark.co.uk/" rel="noopener">
                <img class="footer-sponsor-bytemark" src="https://metacpan.org/static/images/sponsors/bytemark_logo.svg" alt="Bytemark logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.liquidweb.com/" rel="noopener">
                <img class="footer-sponsor-liquidweb" src="https://metacpan.org/static/images/sponsors/liquidweb_logo.png" alt="liquidweb logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://deriv.com/careers/" rel="noopener">
                <img class="footer-sponsor-deriv" src="https://metacpan.org/static/images/sponsors/deriv.svg" alt="Deriv logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://geocode.xyz" rel="noopener">
                <img class="footer-sponsor-geocode" src="https://metacpan.org/static/images/sponsors/geocodelogo.svg" alt="Geocode logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.fastly.com/" rel="noopener">
                <img class="footer-sponsor-fastly" src="https://metacpan.org/static/images/sponsors/fastly_logo.svg" alt="Fastly logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://opencagedata.com" rel="noopener">
                <img class="footer-sponsor-opencage" src="https://metacpan.org/static/images/sponsors/open-cage.svg" alt="OpenCage logo">
              </a>
            </div>
          </div>
        </footer>
        <div class="modal fade" tabindex="-1" role="dialog" id="metacpan_keyboard-shortcuts">
          <div class="modal-dialog">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Keyboard Shortcuts</h4>
              </div>
              <div class="modal-body row">
<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Global</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>s</kbd>
        </td>
        <td>Focus search bar</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>?</kbd>
        </td>
        <td>Bring up this help dialog</td>
      </tr>
    </tbody>
  </table>

  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>GitHub</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>p</kbd>
        </td>
        <td>Go to pull requests</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>go to github issues (only if github is preferred repository)</td>
      </tr>
    </tbody>
  </table>
</div>

<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>POD</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>a</kbd>
        </td>
        <td>Go to author</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>c</kbd>
        </td>
        <td>Go to changes</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>Go to issues</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>d</kbd>
        </td>
        <td>Go to dist</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>r</kbd>
        </td>
        <td>Go to repository/SCM</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>s</kbd>
        </td>
        <td>Go to source</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>b</kbd>
        </td>
        <td>Go to file browse</td>
      </tr>

    </tbody>
  </table>
</div>

<div class="col-md-12">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Search terms</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><em>module:</em> (e.g. <a href="https://metacpan.org/search?q=module%3APlugin">module:Plugin</a>)</td>
      </tr>
      <tr>
        <td><em>distribution:</em> (e.g. <a href="https://metacpan.org/search?q=distribution%3ADancer+auth">distribution:Dancer auth</a>)</td>
      </tr>
      <tr>
        <td><em>author:</em> (e.g. <a href="https://metacpan.org/search?q=author%3ASONGMU+Redis">author:SONGMU Redis</a>)</td>
      </tr>
      <tr>
        <td><em>version:</em> (e.g. <a href="https://metacpan.org/search?q=version%3A1.00">version:1.00</a>)</td>
      </tr>
    </tbody>
  </table>
</div>
              </div>
              <div class="modal-footer"></div>
            </div>
          </div>
        </div>
    </body>
</html>
